package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.TixianBean1;
import com.lwj.liwanjia.impl.TixianView1;
import com.lwj.liwanjia.model.SubmitTixianModel;

import java.util.Map;

import rx.Subscriber;

/**
 * Created by Administrator on 2018/1/10.
 */

public class SubmitTixianPresenter {
    private SubmitTixianModel submitTixianModel;
    private TixianView1 tixianView1;

    public SubmitTixianPresenter(TixianView1 tixianView1) {
        this.tixianView1 = tixianView1;
        this.submitTixianModel = new SubmitTixianModel();
    }

    public void submitTixian(Map<String, Object> map) {
        submitTixianModel.submitTixian(map, new Subscriber<TixianBean1>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {
                tixianView1.showError((Exception) e);
            }

            @Override
            public void onNext(TixianBean1 tixianBean1) {
                tixianView1.submitTixian(tixianBean1);
            }
        });
    }
}
